using System;
using System.Text;

namespace dir
{
    class ArgumentParser
    {
        public static ArgumentParser Create(string[] args)
        {
            var parser = new ArgumentParser();
            parser.Parse(args);
            return parser;
        }

        private void Parse(string[] args)
        {
            try
            {
                if (args.Length != 1)
                    throw new ArgumentException("Only 1 parameter are expected.");

                var outputFile = args[0];
                OutputFilePath = outputFile;
                Invalid = false;
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to parse parameter: {0}", e.Message);
                Invalid = true;
            }
        }

        public bool Invalid { get; private set; }

        public string OutputFilePath { get; private set; }
    }
}